package com.lzxuni.modules.weather.service.impl;

import com.lzxuni.common.utils.HumpUtils;
import com.lzxuni.modules.common.entity.PageParameter;
import com.lzxuni.modules.weather.entity.WeatherLimitDetail;
import com.lzxuni.modules.weather.mapper.WeatherLimitDetailMapper;
import com.lzxuni.modules.weather.service.WeatherLimitDetailService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
import com.lzxuni.common.utils.StringUtils;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

/**
 * <p>
 * 天气信息_天气管理_临界值_明细 服务实现类
 * </p>
 *
 * @author LaoNa
 * @since 2020-12-01
 */
@Service
public class WeatherLimitDetailServiceImpl extends ServiceImpl<WeatherLimitDetailMapper, WeatherLimitDetail> implements WeatherLimitDetailService {

        @Override
        public PageInfo<WeatherLimitDetail> queryPage(PageParameter pageParameter, WeatherLimitDetail weatherLimitDetail) {
            if (StringUtils.isNotEmpty(pageParameter.getSidx())) {
                PageHelper.startPage(pageParameter.getPage(), pageParameter.getRows()).setOrderBy(
                        HumpUtils.humpToLine(pageParameter.getSidx()) + " " + pageParameter.getSord());
            } else {
                PageHelper.startPage(pageParameter.getPage(), pageParameter.getRows());
            }
            List<WeatherLimitDetail> weatherLimitDetailList = baseMapper.queryList(weatherLimitDetail);
            PageInfo<WeatherLimitDetail> pageInfo = new PageInfo<>(weatherLimitDetailList);
            return pageInfo;
        }

        @Override
        public List<WeatherLimitDetail> queryList(WeatherLimitDetail weatherLimitDetail) {
            List<WeatherLimitDetail> weatherLimitDetailList = baseMapper.queryList(weatherLimitDetail);
            return weatherLimitDetailList;
        }

}
